<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,target-densitydpi=medium-dpi">
<title>길거리스타</title> 
<link rel="stylesheet" type="text/css" href="css/default.css">
<!--[if lt IE 9]>
<script>
document.createElement("section");
document.createElement("nav");
document.createElement("article");
document.createElement("aside");
document.createElement("hgroup");
document.createElement("header");
document.createElement("footer");
</script>
<![endif]-->
<script src="js/jquery-1.5.2.min.js"></script>
		<script src="http://maps.google.com/maps/api/js?v=3.3&sensor=true"></script>
		<script src="js/json2.js"></script>
		<script src="js/modernizr-1.7.min.js"></script>
		<script type="text/javascript">
		//<!--

var map;
function initialize() {
  setTimeout(function() { if (window.pageYOffset == 0) window.scrollTo(0, 1) }, 1000);

	var position = new Object();
	
	if(Modernizr.geolocation)	//geolocation support check
	{
		navigator.geolocation.getCurrentPosition(showMap, handleError, {enableHighAccuracy : true, maximumAge : 75000});
	}
	else
	{
		viewPopUp();
	}
}

function showMap(position)
{
	latitude = position.coords.latitude;
	longitude = position.coords.longitude;
	viewPopUp();
}

function handleError(err)
{
	viewPopUp();
}

function viewPopUp() {
      loading = document.getElementById("introLoading");
      loading.style.display='none';
      contents = document.getElementById("pop_popStart");
      contents.style.display='block';
}	

			function getRandomData() {
				var o = new Object();
				o.req = "GET_RANDOM_PERFORMANCE";
				var url = "http://gilstar.com/gilstar/Performance.jsp";
				getJSON(url, o);			
			}

	function getJSON(url, json)
	{
		var requestStr = JSON.stringify(json, replacer);
		//alert(requestStr);
		$.ajax(
			{
				url: url,
				data: requestStr,
				type: "POST",
				success: function(data)
				{
					var resultObject = jQuery.parseJSON(data);
					jsonResponseHandler(resultObject);
				}
			});
	}

	function jsonResponseHandler(result)
	{
		if(result.ResultCode == -1)			//처리 도중 실패.
		{
			noRandomList();
		}

		else if(result.ResultCode == 0)	//성공적으로 처리 완료.
		{
			if(result.ResultMethod.length == 0) {

				noRandomList();
			} else {

				
				var item = result.ResultMethod[0];
				//document.getElementById("artist1").innerHTML = item.artist;
				item.artist;
				item.title;
				item.time;
				item.address;
				item.performance_seq;

				var strHtml = item.title + " by " + item.artist +"<br/>" + item.address + " / " + item.time;
				document.getElementById("popConcertInfo").innerHTML = strHtml;

				var strHref = "view.php?performance_seq=" + item.performance_seq;
				document.getElementById("popConcertInfoHref").href = strHref;
		                pop_popStart = document.getElementById("pop_popStart");
             			pop_popStart.style.display='none';
                		pop_popConcert = document.getElementById("pop_popConcert");
                		pop_popConcert.style.display='block';
			}
			
			
		}
	}

	function replacer(key, value) 
	{
	    if (typeof value === 'number' && !isFinite(value)) 
	    {
	        return String(value);
	    }
	    return value;
	}

	function noRandomList() {
	        pop_popStart = document.getElementById("pop_popStart");
      		pop_popStart.style.display='none';
	        pop_popX = document.getElementById("pop_popX");
      		pop_popX.style.display='block';
	}
//-->
		</script>

<link rel="apple-touch-icon-precomposed" href="파일경로/파일명.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="파일경로/파일명.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="파일경로/파일명.png">
<link rel="apple-touch-startup-image" href="img/startup.png">
<meta name="apple-mobile-web-app-capable" content="yes">
</head> 

<body class="introBody" onLoad="initialize();">

<div class="intro">
	<div class="introVisual"></div>
	<p class="introLoading" id="introLoading">Loading...</p>

	<!-- 뽑기 -->
	<div class="pop popStart" id="pop_popStart">
		<div class="popWrap">
			<h1>기다리기 지루하시죠?<br>오늘의 무작위 공연 뽑기!!</h1>
			<div class="popAction">
				<a href="#" onClick="getRandomData();" class="popBtn">Lucky!</a>
				<a href="/main/map.php" class="popBtn">Pass~</a>
			</div>
			<div class="popVisual"></div>
		</div>
	</div>
	<!-- //뽑기 -->	

	<!-- 꽝 -->
	<div class="pop popX" id="pop_popX">
		<div class="popWrap">
			<h1>꽝... 다음 기회에<br>오늘은 공연이 하나도 없어요.</h1>
			<div class="popAction">
				<a href="map.php" class="popBtn">내일의 공연 정보 보러가기</a>
			</div>
			<div class="popVisual"></div>
		</div>
	</div>
	<!-- //꽝 -->	

	<!-- 공연추천 -->
	<div class="pop popConcert" id="pop_popConcert">
		<div class="popWrap">
			<h1 id='popConcertInfo'>트롯메들리 by 10mm<br>홍대 은하수 카페 / 16:00</h1>
			<img src="img/@artist1.png" width="42" height="42" alt="10mm" class="popArtist">
			<div class="popAction">
				<a href="#" class="popBtn" id="popConcertInfoHref">오늘의 공연 정보 보러가기</a>
			</div>
			<div class="popVisual"></div>
		</div>
	</div>
	<!-- //공연추천 -->	

</div>

</body>
</html>
